#include <iostream>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

class InetAddr
{
public:
    InetAddr(const sockaddr_in addr)
        : _addr(addr)
    {
        _ip = inet_ntoa(addr.sin_addr);
        _port = ntohs(addr.sin_port);
    }

    std::string GetUser()
    {
        std::string temp;
        temp += _ip;
        temp += " : ";
        temp += std::to_string(_port);

        return temp;
    }

    std::string& GetIp()
    {
        return _ip;
    }

    uint16_t GetPort()
    {
        return _port;
    }

    sockaddr_in& GetAddr()
    {
        return _addr;
    }

private:
    std::string _ip;
    uint16_t _port;
    sockaddr_in _addr;
};